The publish/subscribe processing model is one in which producers of information (publishers) and consumers of that same information (subscribers) are not directly connected to each other. The passage of information between the two parties is handled by a publication engine or broker. The publication engine or broker has the responsibility of matching interested parties with the information being published. As not all subscribers necessarily want to receive all published messages, the techniques of topic and content-based routing are used to control what information a subscriber receives.
Topic based routing uses a simple classification mechanism which is implemented as a hierarchal tree. A subscriber can subscribe to receive messages at a particular point in that tree. It could be the root and so all messages are received, or it could be a leaf node in which case only messages published to the leaf node will be received.
Content-based routing provides a mechanism whereby a subscriber can provide a filter expression that will be applied to all messages that match the named point in the topic tree. This filter is typically a Structured Query Language (SQL) like expression that will reference information in the header or body of the message. If the filter condition evaluates to true, then the published message is written to the subscribers queue. If it evaluates to false, then it is not written to the subscribers queue.
Content-based filtering is useful in that it provides an additional filtering mechanism. In current implementations, only one filter expression is supplied, although this could be a complex expression. Although the application designer or business user can think carefully about the construction of the filter statement for the subscriber, this one filter is the only mechanism available to control the amount of information received since they cannot influence the rate at which published messages are made.
When a subscriber's nominated queue becomes full of published messages, no more messages can be received until either the queue size is increased, the subscribing application consumes messages off the queue, or an operator or automated command clears some or all messages off the queue.